package com.feicheng.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.feicheng.base.common.DaoConstant;
import com.feicheng.base.result.Result;
import com.feicheng.entity.Product;
import com.feicheng.model.ProductAndUser;
import com.feicheng.model.WarehouseWithStore;
import com.feicheng.service.ProviderProcurementController;
import com.feicheng.service.ProviderSaleController;
import com.feicheng.service.ProviderWarehouseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @since 2022-07-04
 */
@RestController
@RequestMapping("/product")
public class ProductController {

    // 依赖注入
    @Autowired
    private ProviderWarehouseController providerWarehouseController;

    /* 注入业务逻辑对象 */
    @Autowired
    ProviderSaleController providerSaleController;

    //依赖注入
    @Autowired
    ProviderProcurementController providerProcurementController;

    /**
     * 出库商品名称下拉框查询
     * @param
     * @return
     */
    @GetMapping("/get_name")
    public Result selectProductN(WarehouseWithStore wareHouse) {
        return providerWarehouseController.getProductName(wareHouse);
    }

    /**
     * 调用消费者商品名称下拉列表的伪装接口
     * @author zhennan.liu
     * @param productAndUser
     * @return
     */
    @GetMapping("/product_name/list/g")
    public Result getall(
            @RequestBody ProductAndUser productAndUser){
            Result getall = providerWarehouseController.getall(productAndUser);
            return Result.success(getall);
    }

    /**
     * 商品类别下拉查询
     * @author wei.zhang
     * @return
     */
    @GetMapping("/type/list/g")
    public Result selectProduct(){
        return Result.success(providerWarehouseController.selectProduct());
    }

    /**
     * 新增销售订单商品类型下拉框
     * @param
     * @author jiwei.sun
     * @return
     */
    @GetMapping("/sale_type")
    public Result selectType() {
        return providerSaleController.selectType();
    }

    /**
     * 新增销售订单获取商品名称下拉框
     * @param
     * @author xinyi.yang
     * @return
     */
    @GetMapping("/product_name")
    public Result getProductName(
            String type
    ){
        return providerSaleController.getProductName(type);
    }

    /**
     * 新增采购订单商品类型下拉框
     * @param
     * @author yue.yang
     * @return
     */
    @GetMapping("/type_list")
    public Result selectProductType() {
        return providerProcurementController.selectType();
    }

    /**
     * 采购产品名称下拉框接口
     * @param type 业务参数
     * @author shanshan.zhang
     * @return
     */

    @GetMapping("/product/list")
    public Result selectProduct(String type) {
        return providerProcurementController.selectProduct(type);
    }

}


